package com.zjhb.entity;

import java.util.List;
import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

@javax.persistence.Entity
@javax.persistence.Table(name = "menu", schema = "army", catalog = "")
public class MenuEntity {
	private String id;
	private String name;
	private String url;
	private String parentId;
	private Integer seq;
	private String pub;
	private String leader;
	private String code;
	private List<MenuEntity> nodes;

	@Column(name = "code")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Transient
	public List<MenuEntity> getNodes() {
		return nodes;
	}

	public void setNodes(List<MenuEntity> nodes) {
		this.nodes = nodes;
	}

	@Column(name = "seq")
	public Integer getSeq() {
		return seq;
	}

	public void setSeq(Integer seq) {
		this.seq = seq;
	}

	@Column(name = "pub")
	public String getPub() {
		return pub;
	}

	public void setPub(String pub) {
		this.pub = pub;
	}

	@Column(name = "leader")
	public String getLeader() {
		return leader;
	}

	public void setLeader(String leader) {
		this.leader = leader;
	}

	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	@Column(name = "ID")
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@javax.persistence.Basic
	@javax.persistence.Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@javax.persistence.Basic
	@javax.persistence.Column(name = "url")
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@javax.persistence.Basic
	@javax.persistence.Column(name = "parent_id")
	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;
		MenuEntity that = (MenuEntity) o;
		return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(url, that.url)
				&& Objects.equals(parentId, that.parentId);
	}

	@Override
	public int hashCode() {

		return Objects.hash(id, name, url, parentId);
	}
}
